package com.jt.controller;


import com.jt.entity.Category;
import com.jt.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping("/query")
    public String query( ModelMap modelMap){
        List<Category> categorys = categoryService.queryAll();
        System.out.println(categorys);
        modelMap.addAttribute("categorys",categorys);
        return "category_list";
    }
}
